package moodish.message;

import java.io.Serializable;

import moodish.comm.ServerSideMessage;

/**
 * Message sent from a Client to a server. 
 * Implements ServerSideMessage and this object will be sent to the server using ObjectOutputStream().
 * In the same way the server will receive this object using ObjectInputStream().
 *  
 */
@SuppressWarnings("serial")
public class MessageFromClient implements ServerSideMessage, Serializable {
	private Type type;
	private String nickname;
	private String data;
	
	public MessageFromClient(Type type, String nickname, String data)
	{
		this.type=type;
		this.nickname=nickname;
		this.data=data;
	}

	@Override
	public Type getType() {
		return this.type;
	}

	@Override
	public String getPayload() {
		return this.data;
	}

	@Override
	public String getClientNickname() {
		return this.nickname;
	}
	
	public String toString()
	{
		return this.type + " " + this.nickname + " " + this.data;
	}

}
